package com.stormrage.edu.dao.edu.impl;

import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;

import com.stormrage.edu.dao.edu.EduMajorDao;
import com.stormrage.entity.edu.EduMajor;
import com.stormragetech.core.dao.MysBaseDao;
import com.stormragetech.core.exception.StormrageTechException;

/**
 * @author www.stormragetech.com
 * @date 2016年1月19日
 * @version 1.0.0
 */
@Repository
public class EduMajorDaoImpl extends MysBaseDao implements EduMajorDao {

	private static final Logger logger = LoggerFactory.getLogger(EduMajorDaoImpl.class);

	@Override
	public EduMajor queryByBunchId(final Map<String, Object> map) throws StormrageTechException {

		logger.debug(" 【 Dao 】-【 LeaBunchDao 】-【 QueryMajorById 】- 开始运行 ");

		final String query = "SELECT a.id, a.module FROM edu_major AS a, lea_term AS b, lea_bunch AS c"
				+ " WHERE a.id = b.major_id AND b.id = c.term_id AND c.id = :id";
		logger.debug(" 数据库执行语句为 " + query);

		EduMajor entity = queryObject(query, EduMajor.class, map);

		logger.debug(" 【 Dao 】-【 LeaBunchDao 】-【 QueryMajorById 】- 完成运行 ");
		return entity;

	}

}
